package com.tedu.pj.common.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

/**
 * <p>
 *
 * </p>
 *
 * @author Song
 * @since 2020/10/15
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PageObject<T> implements Serializable {


    private static final long serialVersionUID = 7923376269942704L;
    private Integer pageCurrent =1;
    /**页面大小*/
    private Integer pageSize =3;
    /**总行数(通过查询获得)*/
    private Integer rowCount =0;
    /**总页数(通过计算获得)*/
    private Integer pageCount =0;
    /**当前页记录*/
    private List<T> records ;

    public PageObject(Integer pageCurrent, Integer rowCount, Integer pageSize, List<T> records) {
        this.pageCurrent = pageCurrent;
        this.rowCount = rowCount;
        this.pageSize = pageSize;
        this.records = records;
        this.pageCount=rowCount/pageSize;
        if (rowCount%pageSize!=0){
            this.pageCount++;
        }
    }
}
